﻿@{
    Layout = null;
}
<div class="home-desktop">
    <div class="content-pages-title">
        <h1>添加权限</h1>
    </div>
    <div class="content-notice-body">
        <div class="modular-info" style="display: block;">
            <form action="@(Url.Action("Add"))" method="post" id="form-add-function">
                <table style="width: 100%; border: none;">
                    <tr>
                        <td valign="top">
                            <div class="notice-box-left">
                                <div class="modular-info" style="display: block;">
                                    <ul class="form">
                                        <li>
                                            <em>键值</em>
                                            <input type="text" name="functionKey" maxlength="100" required />
                                        </li>
                                        <li>
                                            <em>名字</em>
                                            <input type="text" name="functionName" maxlength="50" required />
                                        </li>
                                        <li>
                                            <em>链接</em>
                                            <input type="text" name="functionUrl" maxlength="100" />
                                        </li>
                                        <li>
                                            <em>索引</em>
                                            <input type="number" class="inputNumber" name="functionIndex" maxlength="8" required />
                                        </li>
                                        <li>
                                            <em>图标</em>
                                            <input type="text" name="functionIcon" maxlength="100"  />
                                        </li>
                                        <li>
                                            <em>描述</em>
                                            <input type="text" name="functionDescription" maxlength="200"  />
                                        </li>
                                        <li>
                                            <em>父级权限</em>
                                            @Html.DropDownList("ParentID", ViewBag.FunctionList as IEnumerable<SelectListItem>, new { @id = "drop_function" })
                                        </li>
                                        <li class="row-last">
                                            <em>&nbsp;</em>&nbsp;&nbsp;
                                            <button type="button" class="cotrlBtn btnBlue" id="btn_save">保存</button>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                        </td>
                    </tr>
                </table>
            </form>
        </div>
    </div>
</div>
<script type="text/javascript">
    $("#btn_save").click(function () {
        if ($('#form-add-function').valid()) {
            $("#form-add-function").ajaxSubmit({
                datatype: "json",
                data: $('#form-add-function').serialize(),
                success: function (result) {
                    if (result.code == 0) {
                        dcAlert(result.message, 0, 1, function () {
                            $(".layer-dialog-close-btn").click();
                            //刷新显示数据
                            btn_search_click();
                        });
                    }
                    else {
                        dcAlert(result.message, 0, 2);
                    }
                }
            });
        }
    });
</script>
